/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.triumphsys.icici.cmeeting.portlet.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import com.triumphsys.icici.cmeeting.portlet.model.COEPropoalType;
import com.triumphsys.icici.cmeeting.portlet.model.COEPropoalTypeModel;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

/**
 * The base model implementation for the COEPropoalType service. Represents a row in the &quot;CM_CEO_P_TYPE&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.triumphsys.icici.cmeeting.portlet.model.COEPropoalTypeModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link COEPropoalTypeImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a c o e propoal type model instance should use the {@link com.triumphsys.icici.cmeeting.portlet.model.COEPropoalType} interface instead.
 * </p>
 *
 * @author Triumphsys
 * @see COEPropoalTypeImpl
 * @see com.triumphsys.icici.cmeeting.portlet.model.COEPropoalType
 * @see com.triumphsys.icici.cmeeting.portlet.model.COEPropoalTypeModel
 * @generated
 */
public class COEPropoalTypeModelImpl extends BaseModelImpl<COEPropoalType>
	implements COEPropoalTypeModel {
	public static final String TABLE_NAME = "CM_CEO_P_TYPE";
	public static final Object[][] TABLE_COLUMNS = {
			{ "coeProposalTypeId", new Integer(Types.BIGINT) },
			{ "companyId", new Integer(Types.BIGINT) },
			{ "groupId", new Integer(Types.BIGINT) },
			{ "name", new Integer(Types.VARCHAR) },
			{ "desc", new Integer(Types.VARCHAR) }
		};
	public static final String TABLE_SQL_CREATE = "create table CM_CEO_P_TYPE (coeProposalTypeId LONG not null primary key,companyId LONG,groupId LONG,name VARCHAR(75) null,desc VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table CM_CEO_P_TYPE";
	public static final String ORDER_BY_JPQL = " ORDER BY coePropoalType.coeProposalTypeId ASC";
	public static final String ORDER_BY_SQL = " ORDER BY CM_CEO_P_TYPE.coeProposalTypeId ASC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.triumphsys.icici.cmeeting.portlet.model.COEPropoalType"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.triumphsys.icici.cmeeting.portlet.model.COEPropoalType"),
			true);
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.triumphsys.icici.cmeeting.portlet.model.COEPropoalType"));

	public COEPropoalTypeModelImpl() {
	}

	public long getPrimaryKey() {
		return _coeProposalTypeId;
	}

	public void setPrimaryKey(long pk) {
		setCoeProposalTypeId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_coeProposalTypeId);
	}

	public long getCoeProposalTypeId() {
		return _coeProposalTypeId;
	}

	public void setCoeProposalTypeId(long coeProposalTypeId) {
		_coeProposalTypeId = coeProposalTypeId;
	}

	public long getCompanyId() {
		return _companyId;
	}

	public void setCompanyId(long companyId) {
		_companyId = companyId;
	}

	public long getGroupId() {
		return _groupId;
	}

	public void setGroupId(long groupId) {
		_groupId = groupId;
	}

	public String getName() {
		if (_name == null) {
			return StringPool.BLANK;
		}
		else {
			return _name;
		}
	}

	public void setName(String name) {
		_name = name;
	}

	public String getDesc() {
		if (_desc == null) {
			return StringPool.BLANK;
		}
		else {
			return _desc;
		}
	}

	public void setDesc(String desc) {
		_desc = desc;
	}

	public COEPropoalType toEscapedModel() {
		if (isEscapedModel()) {
			return (COEPropoalType)this;
		}
		else {
			return (COEPropoalType)Proxy.newProxyInstance(COEPropoalType.class.getClassLoader(),
				new Class[] { COEPropoalType.class },
				new AutoEscapeBeanHandler(this));
		}
	}

	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
					COEPropoalType.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	public Object clone() {
		COEPropoalTypeImpl coePropoalTypeImpl = new COEPropoalTypeImpl();

		coePropoalTypeImpl.setCoeProposalTypeId(getCoeProposalTypeId());

		coePropoalTypeImpl.setCompanyId(getCompanyId());

		coePropoalTypeImpl.setGroupId(getGroupId());

		coePropoalTypeImpl.setName(getName());

		coePropoalTypeImpl.setDesc(getDesc());

		return coePropoalTypeImpl;
	}

	public int compareTo(COEPropoalType coePropoalType) {
		int value = 0;

		if (getCoeProposalTypeId() < coePropoalType.getCoeProposalTypeId()) {
			value = -1;
		}
		else if (getCoeProposalTypeId() > coePropoalType.getCoeProposalTypeId()) {
			value = 1;
		}
		else {
			value = 0;
		}

		if (value != 0) {
			return value;
		}

		return 0;
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		COEPropoalType coePropoalType = null;

		try {
			coePropoalType = (COEPropoalType)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = coePropoalType.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(11);

		sb.append("{coeProposalTypeId=");
		sb.append(getCoeProposalTypeId());
		sb.append(", companyId=");
		sb.append(getCompanyId());
		sb.append(", groupId=");
		sb.append(getGroupId());
		sb.append(", name=");
		sb.append(getName());
		sb.append(", desc=");
		sb.append(getDesc());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(19);

		sb.append("<model><model-name>");
		sb.append("com.triumphsys.icici.cmeeting.portlet.model.COEPropoalType");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>coeProposalTypeId</column-name><column-value><![CDATA[");
		sb.append(getCoeProposalTypeId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>companyId</column-name><column-value><![CDATA[");
		sb.append(getCompanyId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>groupId</column-name><column-value><![CDATA[");
		sb.append(getGroupId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>name</column-name><column-value><![CDATA[");
		sb.append(getName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>desc</column-name><column-value><![CDATA[");
		sb.append(getDesc());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _coeProposalTypeId;
	private long _companyId;
	private long _groupId;
	private String _name;
	private String _desc;
	private transient ExpandoBridge _expandoBridge;
}